home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / cmn_err.h.z / cmn_err.h
C/C++ Source or Header  |  1992-04-03  |  3KB  |  106 lines

  1. /*    Copyright (c) 1984 AT&T    */
  2. /*      All Rights Reserved      */
  3.  
  4. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  5. /*    The copyright notice above does not evidence any       */
  6. /*    actual or intended publication of such source code.    */
  7.  
  8. /*#ident    "@(#)kern-port:sys/cmn_err.h    10.5"*/
  9. #ident    "$Revision: 3.18 $"
  10.  
  11. #include    "sys/syslog.h"
  12.  
  13. /*
  14. ** Common error handling severity levels.  Converted to be
  15. ** represented by the associated 4.3BSD syslog priorities.
  16. */
  17.  
  18. #define CE_DEBUG    LOG_DEBUG    /* debug    */
  19. #define CE_CONT        LOG_INFO    /* continuation    */
  20. #define CE_NOTE        LOG_NOTICE    /* notice    */
  21. #define CE_WARN        LOG_WARNING    /* warning    */
  22. #define CE_PANIC    LOG_EMERG    /* panic    */
  23.  
  24. #define    CE_LEVELMASK    LOG_PRIMASK    /* mask for severity level    */
  25. #define    CE_CPUID    0x8    /* prepend CPU id to output    */
  26.  
  27. /* Codes for where output should go. */
  28.  
  29. #define    PRW_BUF        0x01    /* Output to putbuf.        */
  30. #define    PRW_CONS    0x02    /* Output to console via sprom.    */
  31. #define PRW_ABUF    0x04    /* Output to arbitrary buffer.    */
  32.  
  33. #ifdef _KERNEL
  34.  
  35. /* Console output flushing flag and routine */
  36.  
  37. extern int constrlen;        /* Length of current console string, if zero,
  38.                    there are no characters to flush */
  39. extern void cmn_err(int, char *, ...);
  40.  
  41. #define    CONBUF_LOCKED    0    /* conbuf is already locked */
  42. #define    CONBUF_UNLOCKED    1    /* need to reacquire lock */
  43.  
  44. /*
  45.  * bit field descriptions for printf %r and %R formats
  46.  *
  47.  * printf("%r %R", val, reg_descp);
  48.  * struct reg_desc *reg_descp;
  49.  *
  50.  * the %r and %R formats allow formatted print of bit fields.  individual
  51.  * bit fields are described by a struct reg_desc, multiple bit fields within
  52.  * a single word can be described by multiple reg_desc structures.
  53.  * %r outputs a string of the format "<bit field descriptions>"
  54.  * %R outputs a string of the format "0x%x<bit field descriptions>"
  55.  *
  56.  * The fields in a reg_desc are:
  57.  *    unsigned rd_mask;    An appropriate mask to isolate the bit field
  58.  *                within a word, and'ed with val
  59.  *
  60.  *    int rd_shift;        A shift amount to be done to the isolated
  61.  *                bit field.  done before printing the isolate
  62.  *                bit field with rd_format and before searching
  63.  *                for symbolic value names in rd_values
  64.  *
  65.  *    char *rd_name;        If non-null, a bit field name to label any
  66.  *                out from rd_format or searching rd_values.
  67.  *                if neither rd_format or rd_values is non-null
  68.  *                rd_name is printed only if the isolated
  69.  *                bit field is non-null.
  70.  *
  71.  *    char *rd_format;    If non-null, the shifted bit field value
  72.  *                is printed using this format.
  73.  *
  74.  *    struct reg_values *rd_values;    If non-null, a pointer to a table
  75.  *                matching numeric values with symbolic names.
  76.  *                rd_values are searched and the symbolic
  77.  *                value is printed if a match is found, if no
  78.  *                match is found "???" is printed.
  79.  *                
  80.  */
  81.  
  82.  
  83. /*
  84.  * register values
  85.  * map between numeric values and symbolic values
  86.  */
  87. struct reg_values {
  88.     unsigned rv_value;
  89.     char *rv_name;
  90. };
  91.  
  92. /*
  93.  * register descriptors are used for formatted prints of register values
  94.  * rd_mask and rd_shift must be defined, other entries may be null
  95.  */
  96. struct reg_desc {
  97.     unsigned rd_mask;    /* mask to extract field */
  98.     int rd_shift;        /* shift for extracted value, - >>, + << */
  99.     char *rd_name;        /* field name */
  100.     char *rd_format;    /* format to print field */
  101.     struct reg_values *rd_values;    /* symbolic names of values */
  102. };
  103.  
  104.  
  105. #endif
  106.